<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<table id="header">
		<tr>
			<td width="100"><img src="../immagini/LogoTD.jpg" width="100" />
			</td>
			<td>
				<h1>Pagina Personale</h1>
			</td>
			<td align="right"><h:form>
					<p:commandButton id="profiloButton" value="Profilo"
						onclick="PF('dlgProfilo').show();" type="button"
						icon="ui-icon-person" />

					<p:dialog id="dialogProfilo" header="Modifica Profilo"
						widgetVar="dlgProfilo" focus="nome" showEffect="clip"
						hideEffect="clip">

						<p:ajax event="close" update="msgAggiornaProfilo, @this" />

						<h:panelGrid id="profiloPanel" columns="3" cellpadding="5">
							<h:outputLabel value="Username:" />
							<h:outputLabel id="username" value="#{userBean.username}" />
							<h:outputLabel></h:outputLabel>

							<h:outputLabel value="Nome:" />
							<p:inputText id="nome" label="nome"
								value="#{registerBean.nomeCorrente}">
								<p:ajax event="click" update="msgAggiornaProfilo" />
							</p:inputText>
							<p:watermark for="nome" value="#{userBean.nome}" />

							<h:outputLabel value="Cognome:" />
							<p:inputText id="cognome" label="cognome"
								value="#{registerBean.cognomeCorrente}">
								<p:ajax event="click" update="msgAggiornaProfilo" />
							</p:inputText>
							<p:watermark for="cognome" value="#{userBean.cognome}" />

							<h:outputLabel value="Email:" />
							<p:inputText id="email" label="email"
								value="#{registerBean.emailCorrente}">
								<p:ajax event="click" update="msgAggiornaProfilo" />
							</p:inputText>
							<p:watermark for="email" value="#{userBean.email}" />

							<p:message id="msgEmail" for="email" />
							<h:outputLabel></h:outputLabel>
							<h:outputLabel></h:outputLabel>

							<h:outputLabel value="Password:" />
							<p:password id="pwd1" value="#{registerBean.pswCorrente}"
								match="pwd2" label="Password">
								<p:ajax event="click" update="msgAggiornaProfilo" />
							</p:password>
							<h:outputLabel></h:outputLabel>

							<h:outputLabel value="Conferma Password:" />
							<p:password id="pwd2" value="#{registerBean.pswCorrente}"
								label="Conferma Password">
								<p:ajax event="click" update="msgAggiornaProfilo" />
							</p:password>
							<h:outputLabel></h:outputLabel>


							<h:outputLabel></h:outputLabel>
							<p:message id="msgPwd" for="pwd1" />
							<h:outputLabel></h:outputLabel>

						</h:panelGrid>
						<p:commandButton id="salvaProfilo" value="Salva"
							update=":welcome, profiloPanel, msgAggiornaProfilo"
							action="#{registerBean.updateProfilo()}" />

						<p:messages id="msgAggiornaProfilo" showDetail="false"
							autoUpdate="false" closable="true" for="salvaProfilo" />
					</p:dialog>
					<p:commandButton action="#{logoutBean.logout}" value="Logout" />
				</h:form></td>
		</tr>
	</table>
	<h:form id="welcome">
		<h1>Benvenuto #{userBean.nome}</h1>
	</h:form>

</ui:composition>
